#include "ros/ros.h"

#include <ros1_protobuf_msg_bridge/srv/StartPathTeach.h>

#include <string>
int count = 0;
int main(int argc, char **argv) {
    ros::init(argc, argv, "srv_client");
    ros::NodeHandle n;

    // 创建服务客户端
    ros::ServiceClient client1 = n.serviceClient<ros1_protobuf_msg_bridge::StartPathTeach>("t_srv1");
    ros1_protobuf_msg_bridge::StartPathTeach srv1;

    if (client1.exists()) {
        ROS_INFO("t_srv1 is ready, sending request...");
        srv1.request.mutable_header()->set_timestamp(1234);
        srv1.request.mutable_header()->set_frame_id("frame_id" + std::to_string(1234));

        if (client1.call(srv1)) {
            ROS_INFO("width: %d", srv1.response.ready());
        } else {
            ROS_ERROR("Failed to call service t_srv1");
        }
    } else {
        ROS_ERROR("Service [t_srv1] does not exist");
        return 1;
    }

    return 0;
}